import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;


public abstract class AbstractProfileBand {
	private List<File> files;
	private List<Profile> profiles;
	private String nick;
	private Style style;
	
	public AbstractProfileBand(String nick, Style style) {
		this.nick = nick;
		this.style = style;
		files = new LinkedList<File>();
		profiles = new ArrayList<Profile>();
	}
	
	public void addProfile(Profile profile){
		profiles.add(profile);
	}

	public void removeProfile(Profile profile) {
		for (int x = 0; x < profiles.size(); x++) {
			if (profile.match(profiles.get(x))) {
				System.out.println("Perfil removido com sucesso!");
				profiles.remove(x);
				break;
			}
		}
	}
	
	public List<Profile> getProfiles() {
		return profiles;
	}
	
	public void addFile(File file){
		files.add(file);
	}
	
	public void removeFile(File file) {
		for (int x = 0; x < files.size(); x++) {
			if (file.match(files.get(x))) {
				System.out.println("Arquivo removido com sucesso!");
				files.remove(x);
				break;
			}
		}
	}
	
	public List<File> search(File file){
		List<File> search = new ArrayList<File>();
		for (File f: files){
			if (file.match(f)){
				search.add(f);
			}
		}
		return search;
	}

	public List<File> getMusics(){
		List<File> musics = new LinkedList<File>();
		for(File file: files){
			if (file instanceof Music){
				musics.add(file);
			}
		}
		return musics;
	}
	
	public List<File> getPhotos() {
		List<File> photos = new LinkedList<File>();
		for(File file: files){
			if (file instanceof Photo){
				photos.add(file);
			}
		}
		return photos;
	}
	
	public List<File> getVideos() {
		List<File> videos = new LinkedList<File>();
		for(File file: files){
			if (file instanceof Video){
				videos.add(file);
			}
		}
		return videos;
	}

	public String getNick() {
		return nick;
	}

	public void setNick(String nick) {
		this.nick = nick;
	}

	public Style getStyle() {
		return style;
	}

	public void setStyle(Style style) {
		this.style = style;
	}
	
	public boolean match(Profile profile) {
		if (!nick.equals(profile.getNick()))
			return false;
		if (!style.equals(profile.getStyle()))
			return false;
		return true;
	}
	
}
